#include Adafruit_NeoPixel.h>

#define PIN_NEOPIXEL D0
#define NUM_PIXELS 16

Adafruit_NeoPixel strip(NUM_PIXELS, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.setBrightness(50);   // brillo de 0 a 255
  strip.show();              // apaga todos al inicio
}

void loop() {
  // Rojo
  fillColor(strip.Color(255, 0, 0));
  delay(1000);

  // Verde
  fillColor(strip.Color(0, 255, 0));
  delay(1000);

  // Azul
  fillColor(strip.Color(0, 0, 255));
  delay(1000);

  // Blanco
  fillColor(strip.Color(255, 255, 255));
  delay(1000);

  // Apagado
  fillColor(strip.Color(0, 0, 0));
  delay(1000);

  // Efecto uno por uno
  colorWipe(strip.Color(255, 100, 0), 80);
  colorWipe(strip.Color(0, 0, 0), 40);
}

void fillColor(uint32_t color) {
  for (int i = 0; i < NUM_PIXELS; i++) {
    strip.setPixelColor(i, color);
  }
  strip.show();
}

void colorWipe(uint32_t color, int waitMs) {
  for (int i = 0; i < NUM_PIXELS; i++) {
    strip.setPixelColor(i, color);
    strip.show();
    delay(waitMs);
  }
}